package com.lancoo.ccas53.pojo.constant;

/**
 * @author quin
 * @ClassName ExcelToEntityEnum.java
 * @Description 添加教室excel中文名字对应数据库标识
 * @createTime 2022年04月29日 10:55:00
 */
public enum ExcelToEntityEnum {

    DA_HUA("大华", 1),
    HIKVISION("海康", 2),
    MING_RI("明日", 3),
    CHEN_AN("晨安", 4),

    ORDINARY_PC("普通PC", 0),
    CENTRAL_CONTROL("中控主机", 1),
    OTHER("其他", 2),

    //是否是4K
    IS_MAIN("是", 1),
    NOT_MAIN("否", 0);


    private String name;
    private int flag;

    ExcelToEntityEnum(String name, int flag) {
        this.name = name;
        this.flag = flag;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getFlag() {
        return flag;
    }

    public void setFlag(int flag) {
        this.flag = flag;
    }

    /**
     * 根据传入的flag返回相应的enum值
     *
     * @param flag
     * @return 返回数据
     */
    public static String stateOf(int flag) {
        for (ExcelToEntityEnum dataEnum : values()) {
            if (dataEnum.getFlag() == flag) {
                return dataEnum.getName();
            }
        }
        return null;
    }

    public static Integer getFlag(String name) {
        for (ExcelToEntityEnum dataEnum : values()) {
            if (dataEnum.getName().equals(name)) {
                return dataEnum.getFlag();
            }
        }
        return null;
    }
}
